package com.daviteq.ems.dao.cassandra.impl;

import com.daviteq.ems.dao.cassandra.BasicDAO;
import com.daviteq.ems.dao.cassandra.IUserDAO;
import com.daviteq.ems.entity.UserEntity;
import com.daviteq.ems.utils.DateTime;

public class UserDAO extends BasicDAO<UserEntity, String>
        implements IUserDAO {

    public static void main(String[] args) {
        
        
        
        IUserDAO userDAO = new UserDAO();
        
        for (int i = 0; i < 200; i++) {
            UserEntity usr = new UserEntity();
            usr.setUsername("user_" + i);
            usr.setPassword("user_" + i);
            usr.setFirstName("first name " + i);
            usr.setLastName("last name " + i);
            usr.setEmail("email_" + i + "@daviteq.com");
            usr.setGender((i%3==0)?"male":"female");
            usr.setStatus((i%3==0)?"ACT":"LCK");
            usr.setFailedLoginAttempts(0);
            usr.setCreatedDate(DateTime.getInstance().getDateTime("dd/MM/yyyy HH:mm:ss"));
            usr.setLastUpdated(DateTime.getInstance().getDateTime("dd/MM/yyyy HH:mm:ss"));
            usr.setLastLogin(DateTime.getInstance().getDateTime("dd/MM/yyyy HH:mm:ss"));
            usr.setBirthday(DateTime.getInstance().getDateTime("dd/MM/yyyy"));
            usr.setMobile("");
            userDAO.persist(usr);
        }
        
        String username = "user_1";
        UserEntity usr = userDAO.findById(username);
        
        System.out.println(usr.getFullName());
    }
    
}
